<?php

function is_exist($userid){//check if the user has existed
	$query="SELECT USERID FROM user WHERE userid=".$userid;
	$result=mysql_query($query);
	$row=mysql_fetch_array($result);
	if($row['USERID']==''){
		return FALSE;
	}else{
		return TRUE;
	}
}
function create_account($userid,$username,$gender,$level,$group='',$newsright=0){//create the user
	$query="INSERT INTO user (
			USERID,
			USERNAME,
			PASSWORD,
			GENDER,
			LEVEL,
			USERGROUP,
			NEWSRIGHT
			) VALUES($userid,'$username','".md5($userid)."',$gender,$level,$group,$newsright)";
	mysql_query($query);
}
function update_account($userid,$username,$gender,$newsright=0){
	$query="UPDATE user SET USERNAME='$username',GENDER=$gender,NEWSRIGHT=$newsright WHERE USERID=$userid";
	mysql_query($query);
}
?>